Thanks a ton. I didn't even have to do the bindings because the disk control options are easily accessible in the retroarch quick menu. I found it by accident when I tried to figure out how to do it; turns out I was pretty close... The only thing I missed was that I was supposed to swap the disk input in between ejecting and closing the virtual tray.
Thanks so much for helping, you managed to find the missing pieces to my puzzle.